/**
 * 选择排序
 */
package com.study.s02.sort;

public class SelectionSort {
	
	public static void sort(long[] array) {	
		
		int k = 0;
		long tmp = 0;
		for (int i = 0; i < array.length - 1; i++) {
			k = i;
			for(int j = i + 1; j < array.length; j++) {
				if(array[j] < array[k]) {
					k = j;
				}
			}
			tmp = array[i];
			array[i] = array[k];
			array[k] = tmp;
		}
	}
}
